//
//  ProtocolHTTPSREST.m
//  etionCBLogic
//
//  Created by wjxfhxy on 1/23/14.
//  Copyright (c) 2014 GuangZhouXuanWu. All rights reserved.
//

#import "ProtocolHTTPSREST.h"

#import "ProtocolTransformType.h"

#import "ProtocolBase.h"

@implementation CProtocolHTTPSREST
{
    NSMutableDictionary *_requestHead;
    NSData *_body;
    NSString *_URI;
    EHTTPRESTMethod _HTTPRESTMethod;
}

@synthesize requestHead = _requestHead;
@synthesize body = _body;
@synthesize URI = _URI;
@synthesize HTTPRESTMethod = _HTTPRESTMethod;

-(id)init
{
    self = [super init];
    
    _requestHead = [NSMutableDictionary new];
    
    return self;
}

+(id)protocolHTTSRESTWithRequestHead
{
    CProtocolHTTPSREST *protocol=[[CProtocolHTTPSREST new]autorelease_mm];
    NSMutableDictionary *head = protocol.requestHead;
    
    [head setObject:@"gzip" forKey:@"Accept-Encoding"];
    [head setObject:@"application/json;charset=utf-8" forKey:@"content-type"];
    [head setObject:[CProtocolBase protocolSessionID].length > 0 ? [CProtocolBase protocolSessionID] : @"" forKey:@"sig"];
    [head setObject:@"v2" forKey:@"v"];
    [head setObject:@"m" forKey:@"s"];
    [head setObject:[XMSGUID GUIDLowString] forKey:@"reqid"];
    [head setObject:[CProtocolTransformType getHTTPSRESTUserNumber] forKey:@"userno"];
    [head setObject:[XMSKeychainItemWrapper uniqueKey] forKey:@"deviceid"];
    return protocol;
}

-(void)dealloc
{
    [_URI release_mm];
    [_requestHead release_mm];
    [_body release_mm];
    superdealloc_mm;
}

@end
